//
//  DWHome.swift
//  DWSwift
//
//  Created by GDL on 2025/6/20.
//

import SwiftUI
import DWCoreLib
import SwiftfulRouting
import SwiftfulLoadingIndicators // 加载指示器
struct DWHomeView: View {
    @Environment(\.router) var router
    // 网络
    @StateObject private var adViewModel = DWAdvertisingViewModel()
    
    var body: some View {
        GeometryReader { proxy in
            VStack(spacing:0) {
                DWButton(title: "网络请求", action: {
                    if adViewModel.adList.count == 0 {
                        adViewModel.fetchADList()
                    }
                }).width(proxy.size.width-40)
                Spacer()
            }
            .frame(maxWidth: .infinity,maxHeight: .infinity)
            .background(Color.red).onAppear(){

            }
        }
    }
}

struct DWHomeView_Previews: PreviewProvider {
    static var previews: some View {
        DWHomeView()
    }
}
